<div id="maincontent">
	<div id="content">
      <div id="mapbox">
		<script src='http://openlayers.org/api/OpenLayers.js'></script>
		<div id='map' style="font-size:0.8em;"></div>
		<script type="text/javascript">
			
			
			
			
			
			var Long = 0.0; var Lat = 0.0; var center = new OpenLayers.Geometry.Point(Long, Lat).transform('EPSG:4326', 'EPSG:3857');
			var overlay = new OpenLayers.Layer.Vector('Overlay', {styleMap: new OpenLayers.StyleMap({externalGraphic: 'gfx/marker.png',graphicWidth: 20, graphicHeight: 20, graphicYOffset: -20,title: '${tooltip}'})});
			map = new OpenLayers.Map({
				controls : [ new OpenLayers.Control.PanZoomBar(),
					new OpenLayers.Control.Navigation(),
					new OpenLayers.Control.Attribution(),
					new OpenLayers.Control.OverviewMap() 
				],
				div: "map", 
				projection: "EPSG:3857", 
				layers: [new OpenLayers.Layer.OSM(), overlay], 
				center: center.getBounds().getCenterLonLat(), 
				zoom: 2
			});
			
			
			
			<?php
			/*
			$sel = "SELECT c.f_key, c.code, c.name, c.longname, COUNT(u.f_key) AS users, c.population FROM places c LEFT JOIN persons p ON (p.country=c.code) LEFT JOIN users u ON (u.f_key=p.f_key) LEFT JOIN machines m ON (m.owner=u.f_key AND m.f_key IS NOT NULL) WHERE m.isactive='YES' AND m.f_key IS NOT NULL AND u.state=1 GROUP BY p.country ORDER BY c.name";
			$ret = $db->getAll_assoc($sel);
			for ($a=0; $a<count($ret); $a++) {
				if ($class == "odd") { $class = "even"; } else { $class = "odd"; }

				$f_key = intval($ret[$a]['f_key']);
				$name = trim($ret[$a]['name']);
				$code = strtolower(trim($ret[$a]['code']));
				$longname = trim($ret[$a]['longname']);
				$usercount = intval($ret[$a]['users']);
				$population = intval($ret[$a]['population']);
				
				$select = "SELECT latitude, longitude FROM `cities` WHERE `name`='".$name."'";
				$selmach = $db->unbuffered_query_first($select);
				$lat = (float)($selmach[0]);
				$long = (float)($selmach[1]);
				
				?>
				
				// Marker <?php echo $a; ?>
				
				var Long = <?php echo $long; ?>;
				var Lat  = <?php echo $lat; ?>;
				var text<?php echo $a; ?> = '<b><?php echo $name; ?></b><br/>Users: <?php echo $usercount; ?>';
				var location<?php echo $a; ?> = new OpenLayers.Geometry.Point(Long, Lat).transform('EPSG:4326', 'EPSG:3857');
				var popup<?php echo $a; ?> = new OpenLayers.Popup.FramedCloud("Popup",  location<?php echo $a; ?>.getBounds().getCenterLonLat(), null, text<?php echo $a; ?>, null, false);
				overlay.addFeatures([new OpenLayers.Feature.Vector(location<?php echo $a; ?>, {tooltip: 'OpenLayers'})]);
				map.addPopup(popup<?php echo $a; ?>);
				
				<?php
			}
			 */
			?>
			
		</script>
    </div>
  </div>
</div>
